// 项目初始化时，是history模式，要改成hash模式；
// history模式需要单独配置，所以不建议使用；

import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/components/Layout.vue';

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      alias: '/login',
      component: () => import('@/views/Account/Login.vue')
    },
    {
      path: '/admin',
      name: 'Admin',
      component: Layout,
      children: [
        {
          path: 'home',
          name: 'AdminHome',
          component: () => import('@/views/Admin/Home.vue')
        },
        {
          path: 'user',
          name: 'User',
          children: [
            {
              path: 'list',
              name: 'UserList',
              component: () => import('@/views/User/List.vue')
            },
            {
              path: 'group',
              name: 'UserGroup',
              component: () => import('@/views/User/Group.vue')
            },
            {
              path: 'label',
              name: 'UserLabel',
              component: () => import('@/views/User/Label.vue')
            },
            {
              path: 'level',
              name: 'UserLevel',
              component: () => import('@/views/User/Level.vue')
            },
          ]
        },
        {
          path: 'product',
          name: 'Product',
          children: [
            {
              path: 'product_list',
              name: 'ProductList',
              component: () => import('@/views/Product/Product_List.vue')
            },
            {
              path: 'add_product',
              name: 'Add_Product',
              component: () => import('@/views/Product/Add_Product.vue')
            },
            {
              path: 'product_classify',
              name: 'Product_Classify',
              component: () => import('@/views/Product/Product_Classify.vue')
            },
            {
              path: 'product_attr',
              name: 'Product_Attr',
              component: () => import('@/views/Product/Product_Attr.vue')
            },
            {
              path: 'product_reply',
              name: 'Product_Reply',
              component: () => import('@/views/Product/Product_Reply.vue')
            },
          ]
        },
      ]
    },

  ]
})

export default router
